package cn.portx.frame.entity;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.bstek.bdf3.dorado.jpa.annotation.Generator;
import com.bstek.dorado.annotation.PropertyDef;

import cn.portx.annotation.ChineseField;
import cn.portx.entity.BaseEntity;
import cn.portx.policy.ChineseToCodeGeneratorPolicy;
import cn.portx.policy.CreateUserPolicy;
import cn.portx.policy.CreatedDatePolicy;
import cn.portx.policy.IdGeneratorPolicy;

@Entity
@Table(name = "T_ZONE")
public class Zone extends BaseEntity {

	private static final long serialVersionUID = -2470498703902608909L;

	@Column(name = "CODE_", length = 30)
	// @ChineseField("name")
	// @Generator(policy = ChineseToCodeGeneratorPolicy.class)
	@PropertyDef(label = "代码")
	private String code;

	@Column(name = "NAME_", length = 60)
	@PropertyDef(label = "名称")
	private String name;

	@Column(name = "LEVEL_")
	@PropertyDef(label = "级别", description = "1:国家；2：省；3：市；4：区县；5：街道")
	private int level;

	@Column(name = "PARENT_ID_", length = 60)
	private String parentId;

	@Transient
	private Zone parent;

	@Transient
	private List<Zone> children;

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getLevel() {
		return level;
	}

	public void setLevel(int level) {
		this.level = level;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public Zone getParent() {
		return parent;
	}

	public void setParent(Zone parent) {
		this.parent = parent;
	}

	public List<Zone> getChildren() {
		return children;
	}

	public void setChildren(List<Zone> children) {
		this.children = children;
	}

}
